package com.way;

/**
 * @author 魏彪
 */
public abstract class AbstractProducer implements Runnable {

    /**
     * 模板方法
     */
    @Override
    public final void run() {
        while (true) {
            produce();
            try {
                Thread.sleep(10);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        }
    }

    protected abstract void produce();
}
